package com.cai.primeton.service;

import com.cai.primeton.entity.PBorrow;
import com.cai.primeton.repository.BorrowRepo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @version 1.0
 * @author：蔡松坡
 * @date：2021/7/6 12 : 47
 * @package：com.cai.primeton.service
 */
@Service
@Transactional
public class BorrowServiceImpl implements BorrowService {

    @Autowired
    private BorrowRepo borrowRepo;
    @Override
    public void save(PBorrow pBorrow) {
        borrowRepo.save(pBorrow);
    }

    @Override
    public void updateState(String state, Long id) {
        borrowRepo.updateState(state,id);
    }

    @Override
    public List<PBorrow> findAllByUseraccount(String account) {
        List<PBorrow> allByUseraccount = borrowRepo.findAllByUseraccount(account);
        return allByUseraccount;
    }
}
